// function compose(f, g){
//     return function(x){
//         return f(g(x))
//     }
// }

// const first_ = arr =>{
//     return arr[0]
// }

// const reverse_ = arr => {
//     return arr.reverse()
// }

// const last = compose(first_, reverse_)
// // console.log(last([1,2,3,4]))

// const _ = require('lodash')

// const toUpper = s => s.toUpperCase()
// const reverse2 = arr => arr.reverse()
// const first = arr => arr[0]

// // const lastUp = _.flowRight(toUpper, first, reverse2)
// // console.log(lastUp(['haha', 'hello', 'xixideidei']))

// // 模拟flowRight

// function flowRight(...arg){
//     return function(value){
//         console.log('wwww',value)
//         return arg.reverse().reduce(function(acc, fn){ return fn(acc) },value)
//     }
// }

// console.log('123',flowRight(toUpper, first, reverse2)(['aaaa','bbbb','cccc','dddd'])) //(['aaaa','bbbb','cccc','dddd'])

// const _ = require('lodash')

// const trace = _.curry((tag, v) => {
//     console.log(tag, v)
//     return v
// })
// const split = _.curry((sep, str) => _.split(str, sep))
// const join = _.curry((sep, array) => _.join(array, sep))
// const map = _.curry((fn, array) => _.map(array, fn))
// const f = _.flowRight(join('-'), trace('map 之后'), map(_.toLower),
// trace('split 之后'), split(' '))
// console.log(f('NEVER SAY DIE'))

const fp = require('lodash/fp')

console.log(fp.map(fp.toUpper, ['a', 'b', 'c']))
console.log(fp.map(fp.toUpper)(['a', 'b', 'c']))
console.log(fp.first('haha ased '))
console.log(fp.first(['11','ss','dd']))
// 只关注过程
